<?php
//首页控制器类
class IndexController extends CommonController{
    //动作方法
    public function index(){
    	// 分类栏目数据
    	$cateData = K('Category')->get_data();
    	// $cateData= Data::tree($cateData,'cname','cid','pid');
    	// p($cateData);
    	$arr = array();
    	foreach ($cateData as $k => $v) {
    		if ($v['pid']==0) {
    			$arr[$k]= $v;
    			$arr[$k]["son"]=$this->get_son($cateData,$v['cid']);
    		}
    	}
    	$cateData = $arr;
        $this->assign('cateData',$cateData);
    	// 首页变量判断
    	$is_index = 1;
    	$this->assign('is_index',$is_index);
        // 最新上架产品
        $newGoods = K('Goods')->get_data('',9,'gid desc');
        // p($newGoods);
        $this->assign('newGoods',$newGoods);
        //显示视图
        $this->dis("index.html");
    }
}
